package com.atguigu.springcloud.service.impl;

import com.atguigu.springcloud.service.ProduceSerivce;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author : zhenyu
 * @Date : 2022/9/5 16:50
 **/
@Service
public class ProduceServiceImpl implements ProduceSerivce {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 生产者发送消息到MQ
     * @param message
     */
    @Override
    public void sendMessage(String exchage, String routingKey, String message) {
        rabbitTemplate.convertAndSend(exchage,routingKey,message);
    }
}
